#!/bin/bash

# Test vdi deletion

. ./common

for i in `seq 0 5`; do
    _start_sheep $i
done

_wait_for_sheep 6

_cluster_format -c 6

echo "delete snapshot image before current one"
_vdi_create test 4G
$DOG vdi snapshot test -s snap
_vdi_list

$DOG vdi delete test -s snap
$DOG vdi delete test -s snap # error
_vdi_list

$DOG vdi delete test
$DOG vdi delete test # error
_vdi_list

echo "delete current image before snapshot one"
_vdi_create test 4G
$DOG vdi snapshot test -s snap
_vdi_list

$DOG vdi delete test
$DOG vdi delete test # error
_vdi_list

$DOG vdi delete test -s snap
$DOG vdi delete test -s snap # error
_vdi_list
